package cn.kxx.controller;

import cn.kxx.constant.MessageConstant;
import cn.kxx.entity.Result;
import cn.kxx.pojo.Setmeal;
import cn.kxx.service.SetmealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "管理前台，体检预约")
@RestController
@RequestMapping("/setmeal")
public class SetmealController {
    @Reference
    private SetmealService setmealService;

    @ApiOperation("获取所有套餐列表")
    @GetMapping("getAllSetmeal")
    public Result getAllSetmeal(){
        List<Setmeal> setmealList = setmealService.findAll();
        return new Result(true, MessageConstant.GET_SETMEAL_LIST_SUCCESS,setmealList);
    }

    @ApiOperation("获取套餐详情，包含体检组信息和体检项信息")
    @GetMapping("/findById/{id}")
    public Result findById(@PathVariable("id")Integer id){
        Setmeal setmeal = setmealService.findSeteamDetailById(id);
        return new Result(true,MessageConstant.QUERY_SETMEAL_SUCCESS,setmeal);
    }

}